package com.guodi.common.config;

import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.io.File;
import java.util.Objects;

/**
 * nacos 上的自定义配置项
 */
@Getter
@Slf4j
@Component
public final class NacosCustomConfig {

    private String gatewayUrl;
    @Value("${gateway.url:}")
    public void setGatewayIp(String gatewayUrl){
        if (StringUtils.isBlank(gatewayUrl)){
            throw new RuntimeException("缺少配置项：gateway.url");
        }
        this.gatewayUrl = gatewayUrl.trim();
    }

    public String getGatewayUrl(){
        return "http://" + this.gatewayUrl;
    }

}
